use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub struct RangeTime {
    #[serde(rename = "min")]
    pub min: Option<String>,
    #[serde(rename = "max")]
    pub max: Option<String>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Gameplay {
    #[serde(rename = "perspective")]
    pub perspective: String,
    #[serde(rename = "flow")]
    pub flow: String,
    #[serde(rename = "genre")]
    pub genre: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct RangeYear {
    #[serde(rename = "min")]
    pub min_year: String,
    #[serde(rename = "max")]
    pub max_year: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct SearchOptionsGames {
    #[serde(rename = "userId")]
    pub user_id: u32,
    #[serde(rename = "platform")]
    pub platform: String,
    #[serde(rename = "sortCategory")]
    pub sort_category: String,
    #[serde(rename = "rangeCategory")]
    pub range_category: String,
    #[serde(rename = "rangeTime")]
    pub range_time: RangeTime,
    #[serde(rename = "gameplay")]
    pub gameplay: Gameplay,
    #[serde(rename = "rangeYear")]
    pub range_year: RangeYear,
    #[serde(rename = "modifier")]
    pub modifier: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct SearchOptionsUsers {
    #[serde(rename = "sortCategory")]
    pub sort_category_users: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct SearchOptionsLists {
    #[serde(rename = "sortCategory")]
    pub sort_category_lists: String,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct SearchOptions {
    #[serde(rename = "games")]
    pub games: SearchOptionsGames,
    #[serde(rename = "users")]
    pub users: SearchOptionsUsers,
    #[serde(rename = "lists")]
    pub lists: SearchOptionsLists,
    #[serde(rename = "filter")]
    pub filter: String,
    #[serde(rename = "sort")]
    pub sort: u32,
    #[serde(rename = "randomizer")]
    pub randomizer: u32,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct JsonData {
    #[serde(rename = "searchType")]
    pub search_type: String,
    #[serde(rename = "searchTerms")]
    pub search_terms: Vec<String>,
    #[serde(rename = "searchPage")]
    pub search_page: u32,
    #[serde(rename = "size")]
    pub size: u32,
    #[serde(rename = "searchOptions")]
    pub search_options: SearchOptions,
    #[serde(rename = "useCache")]
    pub use_cache: bool,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct GameData {
    #[serde(rename = "color")]
    pub color: Option<String>,
    #[serde(rename = "title")]
    pub title: Option<String>,
    #[serde(rename = "category")]
    pub category: Option<String>,
    #[serde(rename = "count")]
    pub count: Option<i32>,
    #[serde(rename = "pageCurrent")]
    pub page_current: Option<i32>,
    #[serde(rename = "pageTotal")]
    pub page_total: Option<i32>,
    #[serde(rename = "pageSize")]
    pub page_size: Option<i32>,
    pub data: Option<Vec<Game>>,
    #[serde(rename = "userData")]
    pub user_data: Option<Vec<serde_json::Value>>,
    #[serde(rename = "displayModifier")]
    pub display_modifier: Option<String>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Game {
    pub game_id: Option<i32>,
    pub game_name: Option<String>,
    pub game_name_date: Option<i32>,
    pub game_alias: Option<String>,
    pub game_type: Option<String>,
    pub game_image: Option<String>,
    pub comp_lvl_combine: Option<i32>,
    pub comp_lvl_sp: Option<i32>,
    pub comp_lvl_co: Option<i32>,
    pub comp_lvl_mp: Option<i32>,
    pub comp_main: Option<i32>,
    pub comp_plus: Option<i32>,
    pub comp_100: Option<i32>,
    pub comp_all: Option<i32>,
    pub comp_main_count: Option<i32>,
    pub comp_plus_count: Option<i32>,
    pub comp_100_count: Option<i32>,
    pub comp_all_count: Option<i32>,
    pub invested_co: Option<i32>,
    pub invested_mp: Option<i32>,
    pub invested_co_count: Option<i32>,
    pub invested_mp_count: Option<i32>,
    pub count_comp: Option<i32>,
    pub count_speedrun: Option<i32>,
    pub count_backlog: Option<i32>,
    pub count_review: Option<i32>,
    pub review_score: Option<i32>,
    pub count_playing: Option<i32>,
    pub count_retired: Option<i32>,
    pub profile_popular: Option<i32>,
    pub release_world: Option<i32>,
}